package com.camerareader.mvp;

import android.content.Context;
import android.content.SharedPreferences;

import org.json.JSONException;
import org.json.JSONObject;

import java.io.Serializable;

/**
 * Created by springsky on 2018/6/20.
 */

public class OrderInfoModel implements Serializable{
    private static final String SHARED_PREFERENCE_NAME = "OrderInfoModel";

    public String Store_Title;//门店名称
    public int Order_State;//订单状态[1或者2]的时候
    public String Order_Num;//订单号
    public String Create_Time;//订单创建时间
    public String Pay_State;//支付状态说明
    public String Product_Title;//产品名称
    public String Product_Cover;//产品封面
    public double Actual_Total;//产品价格
    public int Buy_Number;//购买数量
    public String Modelling;//化妆/造型说明
    public String Service_Time;//服务时间
    public String Shot_Number;//拍摄照片数量
    public String Refinement_Number;//精修照片数量
    public String Product_Describe ;//产品描述
    public String Shot_Upload_Url;//阿里云上传路



    public static OrderInfoModel orderInfoModelWithJSON(String json){



        OrderInfoModel model = new OrderInfoModel();
        JSONObject jsonObject = null;
        try {
            jsonObject = new JSONObject(json);
        } catch (JSONException e) {
            e.printStackTrace();
        }
        if(jsonObject == null){
            return model;
        }

        model.Store_Title = jsonObject.optString("Store_Title");
        model.Order_State = jsonObject.optInt("Order_State");
        model.Order_Num = jsonObject.optString("Order_Num");
        model.Create_Time = jsonObject.optString("Create_Time");
        model.Pay_State = jsonObject.optString("Pay_State");
        model.Product_Cover = jsonObject.optString("Product_Cover");
        model.Product_Title = jsonObject.optString("Product_Title");
        model.Actual_Total = jsonObject.optDouble("Actual_Total");
        model.Buy_Number = jsonObject.optInt("Buy_Number");
        model.Actual_Total = jsonObject.optDouble("Actual_Total");
        model.Modelling = jsonObject.optString("Modelling");
        model.Service_Time = jsonObject.optString("Service_Time");
        model.Shot_Number = jsonObject.optString("Shot_Number");
        model.Refinement_Number = jsonObject.optString("Refinement_Number");
        model.Shot_Upload_Url = jsonObject.optString("Shot_Upload_Url");
        model.Product_Describe = jsonObject.optString("Product_Describe");

        return model;
    }
}
